package com.woniu.aspect;

import org.apache.log4j.Logger;
import org.springframework.aop.AfterReturningAdvice;
import org.springframework.aop.MethodBeforeAdvice;

import java.lang.reflect.Method;

/**
 * @author zhaolei
 * @date 2021/4/14 - 22:15
 */
public class CookieAspect implements MethodBeforeAdvice, AfterReturningAdvice {
    private Logger logger = Logger.getLogger(this.getClass());
    @Override
    public void before(Method method, Object[] objects, Object o) throws Throwable {
        logger.info("买菜");
        logger.info("切菜");
        logger.info("下厨房");
    }

    @Override
    public void afterReturning(Object o, Method method, Object[] objects, Object o1) throws Throwable {
        logger.info("洗碗");
        logger.info("扔垃圾");
    }
}
